<template>
  <div class="callus">
    <div>
      <Head></Head>
    </div>
    <div class="callus-box">
      <el-form
        :model="dynamicValidateForm"
        status-icon
        ref="dynamicValidateForm"
        class="demo-dynamic"
      >
        <el-form-item
          prop="email"
          label="邮箱"
          :rules="[
            { required: true, message: '请输入邮箱地址', trigger: 'blur' },
            {
              type: 'email',
              message: '请输入正确的邮箱地址',
              trigger: ['blur', 'change'],
            },
          ]"
        >
          <el-input v-model="dynamicValidateForm.email"></el-input>
        </el-form-item>
        <el-form-item
          prop="desc"
          label="作品"
          :rules="[
            { required: true, message: '请输入你的作品', trigger: 'blur' },
          ]"
        >
          <el-input
            type="textarea"
            v-model="dynamicValidateForm.desc"
          ></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitForm('dynamicValidateForm')"
            >提交</el-button
          >
          <el-button @click="resetForm('dynamicValidateForm')">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="tip">
      <p>提交成功后 我们会审核您的作品 相关信息会通过邮箱通知您！</p>
    </div>
    <div class="text">
      <div class="img">
        <img
          src="https://www.imageoss.com/images/2021/10/16/8c07df70ab9540911ae51eea900914cc368d6a0f98bd7862.png"
          alt=""
        />
      </div>
      <div class="content">
        <span>书写你的梦想</span>
        <span>让它飞向远方</span>
      </div>
    </div>
  </div>
</template>

<script>
import Head from "../components/head";
export default {
  data() {
    return {
      dynamicValidateForm: {
        domains: [
          {
            value: "",
          },
        ],
        email: "",
        desc: "",
      },
    };
  },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          this.$swal({
            icon: "success",
            title: "提交成功！",
          });
        } else {
          return false;
        }
      });
    },
    resetForm(formName) {
      this.$refs[formName].resetFields();
      this.$swal({
        icon: "success",
        title: "已完成重置！",
      });
    },
  },
  components: {
    Head,
  },
};
</script>

<style scoped>
@import "../css/callus.css";
</style>
